<html>
<head><meta charset="utf-8"><title>More aggressive pipelining · t-compiler/wg-pipelining · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/195180-t-compiler/wg-pipelining/index.html">t-compiler/wg-pipelining</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/195180-t-compiler/wg-pipelining/topic/More.20aggressive.20pipelining.html">More aggressive pipelining</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="174749169"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/195180-t-compiler/wg-pipelining/topic/More%20aggressive%20pipelining/near/174749169" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/195180-t-compiler/wg-pipelining/topic/More.20aggressive.20pipelining.html#174749169">(Sep 03 2019 at 00:12)</a>:</h4>
<p>I tried making pipelining more aggressive, by moving metadata generation from after analysis (typeck, borrowck, etc.) to before analysis. This increases the amount of overlap possible. It's basically working (only 3 tests fail in the entire rustc test suite, not sure why yet), but the performance results are disappointing: <a href="https://paste.mozilla.org/0qBZWYjv" target="_blank" title="https://paste.mozilla.org/0qBZWYjv">https://paste.mozilla.org/0qBZWYjv</a></p>



<a name="174749238"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/195180-t-compiler/wg-pipelining/topic/More%20aggressive%20pipelining/near/174749238" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/195180-t-compiler/wg-pipelining/topic/More.20aggressive.20pipelining.html#174749238">(Sep 03 2019 at 00:14)</a>:</h4>
<p>That shows the effect of the existing pipelining, which has some big speedups like 1.79x, 1.39x, 1.38x, 1.17x.</p>



<a name="174749245"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/195180-t-compiler/wg-pipelining/topic/More%20aggressive%20pipelining/near/174749245" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/195180-t-compiler/wg-pipelining/topic/More.20aggressive.20pipelining.html#174749245">(Sep 03 2019 at 00:15)</a>:</h4>
<p>It also shows the effect of the more aggressive pipelining, which has much smaller speedups like 1.06x, 1.04x, 1.02x (and the 1.02x is probably indistinguishable from noise)</p>



<a name="174749259"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/195180-t-compiler/wg-pipelining/topic/More%20aggressive%20pipelining/near/174749259" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/195180-t-compiler/wg-pipelining/topic/More.20aggressive.20pipelining.html#174749259">(Sep 03 2019 at 00:15)</a>:</h4>
<p>I guess in hindsight it's not that surprising; code generation takes a lot longer than analysis</p>



<a name="174749381"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/195180-t-compiler/wg-pipelining/topic/More%20aggressive%20pipelining/near/174749381" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/195180-t-compiler/wg-pipelining/topic/More.20aggressive.20pipelining.html#174749381">(Sep 03 2019 at 00:18)</a>:</h4>
<p>Also, the more aggressive pipelining slows down some workflows slightly -- the production of type/borrow/other errors is slightly delayed by metadata generation. And that's a common workflow -- think about when you're repeatedly compiling code when working through errors.</p>



<a name="174749385"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/195180-t-compiler/wg-pipelining/topic/More%20aggressive%20pipelining/near/174749385" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/195180-t-compiler/wg-pipelining/topic/More.20aggressive.20pipelining.html#174749385">(Sep 03 2019 at 00:19)</a>:</h4>
<p>So I think it's probably not worthwhile pursuing further, overall.</p>



<a name="174749651"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/195180-t-compiler/wg-pipelining/topic/More%20aggressive%20pipelining/near/174749651" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Zoxc <a href="https://rust-lang.github.io/zulip_archive/stream/195180-t-compiler/wg-pipelining/topic/More.20aggressive.20pipelining.html#174749651">(Sep 03 2019 at 00:27)</a>:</h4>
<p>Did you measure how much time was spent doing analysis after metadata generation? I'd expect metadata generation to basically trigger all of it.</p>



<a name="174752665"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/195180-t-compiler/wg-pipelining/topic/More%20aggressive%20pipelining/near/174752665" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/195180-t-compiler/wg-pipelining/topic/More.20aggressive.20pipelining.html#174752665">(Sep 03 2019 at 02:03)</a>:</h4>
<p>I rearranged things so that metadata generation finished before analysis started. This was non-trivial, given the way the passes are arranged.</p>



<a name="174756890"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/195180-t-compiler/wg-pipelining/topic/More%20aggressive%20pipelining/near/174756890" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/195180-t-compiler/wg-pipelining/topic/More.20aggressive.20pipelining.html#174756890">(Sep 03 2019 at 04:06)</a>:</h4>
<p>I have filed <a href="https://github.com/rust-lang/rust/issues/64112" target="_blank" title="https://github.com/rust-lang/rust/issues/64112">#64112</a> so others can see the code and results.</p>



<a name="174835214"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/195180-t-compiler/wg-pipelining/topic/More%20aggressive%20pipelining/near/174835214" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/195180-t-compiler/wg-pipelining/topic/More.20aggressive.20pipelining.html#174835214">(Sep 03 2019 at 22:25)</a>:</h4>
<p><span class="user-mention" data-user-id="116015">@Alex Crichton</span> ^^^ (in case you haven't already seen it)</p>



<a name="174887905"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/195180-t-compiler/wg-pipelining/topic/More%20aggressive%20pipelining/near/174887905" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/195180-t-compiler/wg-pipelining/topic/More.20aggressive.20pipelining.html#174887905">(Sep 04 2019 at 14:37)</a>:</h4>
<p>Hm interesting! It may also be the case that the meteadata generation ends up needing all of the analysis anyway, so moving it back may not actually skip any stages of compilation before it's generated</p>



<a name="174888046"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/195180-t-compiler/wg-pipelining/topic/More%20aggressive%20pipelining/near/174888046" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/195180-t-compiler/wg-pipelining/topic/More.20aggressive.20pipelining.html#174888046">(Sep 04 2019 at 14:39)</a>:</h4>
<p><span class="user-mention" data-user-id="120989">@nnethercote</span> it may be worth looking into optimizing metadata at some point</p>



<a name="174888062"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/195180-t-compiler/wg-pipelining/topic/More%20aggressive%20pipelining/near/174888062" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/195180-t-compiler/wg-pipelining/topic/More.20aggressive.20pipelining.html#174888062">(Sep 04 2019 at 14:39)</a>:</h4>
<p>IIRC it's pretty quick but still like megabyte big for a kilobyte crate</p>



<a name="174888077"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/195180-t-compiler/wg-pipelining/topic/More%20aggressive%20pipelining/near/174888077" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/195180-t-compiler/wg-pipelining/topic/More.20aggressive.20pipelining.html#174888077">(Sep 04 2019 at 14:39)</a>:</h4>
<p>so we're probably taking too long to emit it and/or storing way too much in there in one form or another</p>



<a name="174898788"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/195180-t-compiler/wg-pipelining/topic/More%20aggressive%20pipelining/near/174898788" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Taylor Cramer <a href="https://rust-lang.github.io/zulip_archive/stream/195180-t-compiler/wg-pipelining/topic/More.20aggressive.20pipelining.html#174898788">(Sep 04 2019 at 16:33)</a>:</h4>
<p>+1 this would also help with distributed builds-- sending metadata elsewhere is slow today</p>



<a name="174902865"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/195180-t-compiler/wg-pipelining/topic/More%20aggressive%20pipelining/near/174902865" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Zoxc <a href="https://rust-lang.github.io/zulip_archive/stream/195180-t-compiler/wg-pipelining/topic/More.20aggressive.20pipelining.html#174902865">(Sep 04 2019 at 17:24)</a>:</h4>
<p>Just FYI, I'd like to remove metadata and just rely on stored queries instead. We currently store a lot of information in both metadata and the query cache, which is not very efficient.</p>



<a name="174920221"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/195180-t-compiler/wg-pipelining/topic/More%20aggressive%20pipelining/near/174920221" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/195180-t-compiler/wg-pipelining/topic/More.20aggressive.20pipelining.html#174920221">(Sep 04 2019 at 20:33)</a>:</h4>
<p><span class="user-mention" data-user-id="116015">@Alex Crichton</span> I used debugging println statements to verify that metadata generation completes before analysis. It's possible I'm missing some subtlety, but the basic contours seem correct, and the results suggest that things really have changed to some degree.</p>



<a name="174920252"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/195180-t-compiler/wg-pipelining/topic/More%20aggressive%20pipelining/near/174920252" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/195180-t-compiler/wg-pipelining/topic/More.20aggressive.20pipelining.html#174920252">(Sep 04 2019 at 20:33)</a>:</h4>
<p><span class="user-mention" data-user-id="116015">@Alex Crichton</span> What are the filenames for metadata? .rmeta?</p>



<a name="174920911"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/195180-t-compiler/wg-pipelining/topic/More%20aggressive%20pipelining/near/174920911" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/195180-t-compiler/wg-pipelining/topic/More.20aggressive.20pipelining.html#174920911">(Sep 04 2019 at 20:40)</a>:</h4>
<p><span class="user-mention" data-user-id="120989">@nnethercote</span> yeah <code>*.rmeta</code></p>



<a name="174920919"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/195180-t-compiler/wg-pipelining/topic/More%20aggressive%20pipelining/near/174920919" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/195180-t-compiler/wg-pipelining/topic/More.20aggressive.20pipelining.html#174920919">(Sep 04 2019 at 20:40)</a>:</h4>
<p>and rustc has tons of caches internally</p>



<a name="174920929"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/195180-t-compiler/wg-pipelining/topic/More%20aggressive%20pipelining/near/174920929" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/195180-t-compiler/wg-pipelining/topic/More.20aggressive.20pipelining.html#174920929">(Sep 04 2019 at 20:40)</a>:</h4>
<p>so the time previously spent in analysis may just be shifted to metadata generation now</p>



<a name="174920932"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/195180-t-compiler/wg-pipelining/topic/More%20aggressive%20pipelining/near/174920932" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/195180-t-compiler/wg-pipelining/topic/More.20aggressive.20pipelining.html#174920932">(Sep 04 2019 at 20:40)</a>:</h4>
<p>(maybe)</p>



<a name="174920946"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/195180-t-compiler/wg-pipelining/topic/More%20aggressive%20pipelining/near/174920946" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/195180-t-compiler/wg-pipelining/topic/More.20aggressive.20pipelining.html#174920946">(Sep 04 2019 at 20:41)</a>:</h4>
<p>and the analysis phase, which happens later, just hits all the caches and doesn't actually do anything</p>



<a name="174920964"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/195180-t-compiler/wg-pipelining/topic/More%20aggressive%20pipelining/near/174920964" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/195180-t-compiler/wg-pipelining/topic/More.20aggressive.20pipelining.html#174920964">(Sep 04 2019 at 20:41)</a>:</h4>
<p>right, that's the subtleties/contours I was referring to</p>



<a name="174920965"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/195180-t-compiler/wg-pipelining/topic/More%20aggressive%20pipelining/near/174920965" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/195180-t-compiler/wg-pipelining/topic/More.20aggressive.20pipelining.html#174920965">(Sep 04 2019 at 20:41)</a>:</h4>
<p>just random guess as to why it may not help much</p>



<a name="174920991"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/195180-t-compiler/wg-pipelining/topic/More%20aggressive%20pipelining/near/174920991" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/195180-t-compiler/wg-pipelining/topic/More.20aggressive.20pipelining.html#174920991">(Sep 04 2019 at 20:41)</a>:</h4>
<p>codegen does take like 10x longer than analysis</p>



<a name="174920999"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/195180-t-compiler/wg-pipelining/topic/More%20aggressive%20pipelining/near/174920999" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/195180-t-compiler/wg-pipelining/topic/More.20aggressive.20pipelining.html#174920999">(Sep 04 2019 at 20:41)</a>:</h4>
<p>heh that too!</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>